package com.itbaizhan.domian;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

/**
 * 统一结果返回集
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class R {

    // 状态码
    private int code;

    // 返回信息
    private String meg;

    // 数据
    private Object data;

    public static R fail(String meg){
        R r = new R();
        r.setCode(500);
        r.setMeg(meg);
        return r;
    }
    public static R ok(Object data){
        R r = new R();
        r.setCode(200);
        r.setMeg("sucess");
        r.setData(data);
        return r;
    }
}
